using System;
using System.Collections.Generic;
using System.Text;

namespace LuaNetInterface
{
    /// <summary>
    /// This class defines an attribute to register a Lua function.
    /// </summary>
    /// <remarks>This is typically used as an attribute on a method definition.</remarks>
    public class LuaFunctionAttribute : Attribute
    {
        #region Data Members
        /// <summary>
        /// The name of the function.
        /// </summary>
        private string _name;

        /// <summary>
        /// The documentation attached to the function.
        /// </summary>
        private string _documentation;

        /// <summary>
        /// The method parameters required by the function.
        /// </summary>
        private string[] _parameters = null;
        #endregion

        #region Properties
        /// <summary>
        /// Gets the name of the package.
        /// </summary>
        public string Name
        {
            get { return _name; }
        }

        /// <summary>
        /// Gets the documentation attached to the package.
        /// </summary>
        public string Documentation
        {
            get { return _documentation; }
        }

        /// <summary>
        /// Gets the method parameters required by the function.
        /// </summary>
        public string[] Parameters
        {
            get { return _parameters; }
        }
        #endregion

        #region Methods
        /// <summary>
        /// Creates a Lua function attribute and assigns a name and documentation to the function.
        /// </summary>
        /// <param name="name">The name of the function.</param>
        /// <param name="documentation">The documentation attached to the function.</param>
        public LuaFunctionAttribute(string name, string documentation)
        {
            if (name == null)
                throw new ArgumentNullException();

            _name = name;
            _documentation = documentation;
        }

        /// <summary>
        /// Creates a Lua function attribute and assigns a name and documentation to the function.
        /// </summary>
        /// <param name="name">The name of the function.</param>
        /// <param name="documentation">The documentation attached to the function.</param>
        /// <param name="parameters">The method parameters required by the function.</param>
        public LuaFunctionAttribute(string name, string documentation, params string[] parameters)
        {
            _name = name;
            _documentation = documentation;
            _parameters = parameters;
        }
        #endregion
    }
}
